Browse Source

Added mistrust. Tests still in an intermediate state

JNI-44
Edouard Tisserant 10 years ago
parent
commit
0a57dd3b25
  1. 40
      androidTests/app/src/main/java/com/pep/k9/MainActivity.java
  2. 3
      src/pEp.yml2

40
androidTests/app/src/main/java/com/pep/k9/MainActivity.java

@ -46,10 +46,10 @@ public class MainActivity extends AppCompatActivity {
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
try {
testPEpTypes();
//testPEpTypes();
testPEpAliceBobJohn();
testKeyserverLookup();
testKeyGen();
//testKeyserverLookup();
//testKeyGen();
}
catch (Exception ex) {
Log.e("PEPTEST", "##################### TEST Exception ####################",ex);
@ -437,6 +437,29 @@ public class MainActivity extends AppCompatActivity {
to.add(bob);
msg.setTo(to);
msg.setShortmsg("hello, world");
msg.setLongmsg("this is a test");
msg.setDir(Message.Direction.Outgoing);
Color aclr = e.outgoing_message_color(msg);
if(!(aclr.equals(Color.pEpRatingReliable))) throw new AssertionError();
e.trustPersonalKey(bob);
Color bclr = e.outgoing_message_color(msg);
if(!(bclr.equals(Color.pEpRatingTrusted))) throw new AssertionError();
e.keyResetTrust(bob);
Color cclr = e.outgoing_message_color(msg);
if(!(cclr.equals(Color.pEpRatingReliable))) throw new AssertionError();
e.keyCompromized(bob);
Color dclr = e.outgoing_message_color(msg);
if(!(dclr.equals(Color.pEpRatingUnencrypted))) throw new AssertionError();
e.keyResetTrust(bob);
Color oclr = e.outgoing_message_color(msg);
if(!(oclr.equals(Color.pEpRatingReliable))) throw new AssertionError();
Vector<Identity> cc = new Vector<Identity>();
cc.add(alice);
msg.setCc(cc);
@ -445,9 +468,6 @@ public class MainActivity extends AppCompatActivity {
bcc.add(john);
msg.setBcc(bcc);
msg.setShortmsg("hello, world");
msg.setLongmsg("this is a test");
{
ArrayList<Pair<String, String>> pairs = new ArrayList<Pair<String, String>>();
pairs.add(new Pair<String,String>("Received","in time"));
@ -485,7 +505,6 @@ public class MainActivity extends AppCompatActivity {
msg.setAttachments(attachments);
}
msg.setDir(Message.Direction.Outgoing);
if(!(e.outgoing_message_color(msg).equals(Color.pEpRatingReliable))) throw new AssertionError();
Message enc = null;
@ -505,13 +524,6 @@ public class MainActivity extends AppCompatActivity {
if(!(result.dst.getShortmsg().equals("hello, world"))) throw new AssertionError();
if(!(result.dst.getLongmsg().equals("this is a test"))) throw new AssertionError();
/* TODO
if(!(result.color.equals(Color.pEpRatingReliable))) throw new AssertionError();
e.trustPersonalKey(john);
e.keyResetTrust(john);
e.keyCompromized(john);
*/
ArrayList<Pair<String, String>> _pairs = result.dst.getOptFields();
/* FIXME ?
{

3
src/pEp.yml2

@ -64,9 +64,10 @@ namespace pEp {
pEp_rating_trusted_and_anonymized > 7
pEp_rating_fully_anonymous > 8
pEp_rating_under_attack > -1
pEp_rating_mistrust > -1
pEp_rating_red > -1
pEp_rating_b0rken > -2
pEp_rating_under_attack > -3
};
interface Engine {

Loading…
Cancel
Save