Beispiel #1
0
 def on_entry1(entry):
     # "RWCN-94NV-CEHR" -> ("RWCN", "94NV", "CEHR") | None
     vaction_code = parse_activation_code(entry.get_text())
     if vaction_code:
         entry1.modify_fg(Gtk.StateFlags.NORMAL, None)
         button1.set_sensitive(True)
     else:
         entry1.modify_fg(Gtk.StateFlags.NORMAL, Color(50000, 0, 0))
         button1.set_sensitive(False)
Beispiel #2
0
        def on_button1(_):
            vaction_code = parse_activation_code(entry1.get_text())
            if vaction_code:
                vaction_code = '-'.join(vaction_code.groups())
            if type(self.profile.vaction_oid) == str:
                vaction_oid = uuid.UUID(self.profile.vaction_oid)
            else:
                vaction_oid = self.profile.vaction_oid
            result = yield self.session._do_onboard_member_verify(vaction_oid, vaction_code)
            pprint(result)

            self.profile.vaction_verified = str(np.datetime64(result['created'], 'ns'))
            self.profile.vaction_transaction = '0x' + str(binascii.b2a_hex(result['transaction']).decode())
            self.profile.member_oid = str(uuid.UUID(bytes=result['member_oid']))
            self.config.profiles[self.profile_name] = self.profile
            self.config.save(self.input_password)
Beispiel #3
0
 def test_parse_invalid_activation_codes(self):
     for i in range(20):
         code = b2a_hex(os.urandom(20)).decode()
         parsed_code = parse_activation_code(code)
         self.assertEqual(None, parsed_code)
Beispiel #4
0
 def test_parse_valid_activation_codes(self):
     for i in range(20):
         code = generate_activation_code()
         parsed_code = parse_activation_code(code)
         self.assertTupleEqual(tuple(code.split('-')), parsed_code.groups())