Пример #1
0
 def test_delete_private_key_does(self):
     self.assertEquals(len(OneTimePad.objects.all()), 0)
     sheet = Sheet()
     user = User(username='******')
     user.save()
     sheet.owner = user
     sheet.create_private_key()
     self.assertEquals(len(OneTimePad.objects.all()), 1)
     sheet._delete_private_key()
     self.assertEquals(len(OneTimePad.objects.all()), 0)
Пример #2
0
 def test_delete_private_key_does(self):
     self.assertEquals(len(OneTimePad.objects.all()), 0)
     sheet = Sheet()
     user = User(username='******')
     user.save()
     sheet.owner = user
     sheet.create_private_key()
     self.assertEquals(len(OneTimePad.objects.all()), 1)
     sheet._delete_private_key()
     self.assertEquals(len(OneTimePad.objects.all()), 0)
Пример #3
0
 def test_create_private_key_uses_onetimepad(self):
     sheet = Sheet()
     sheet.version = 155
     user = User(username='******')
     user.set_password('glurk')
     user.save()
     sheet.owner = user
     self.assertEquals(len(OneTimePad.objects.all()), 0)
     self.assertEquals(sheet.create_private_key(),
                       OneTimePad.objects.get(user=sheet.owner).guid)
     sheet._delete_private_key()
Пример #4
0
 def test_create_private_key_uses_onetimepad(self):
     sheet = Sheet()
     sheet.version = 155
     user = User(username='******')
     user.set_password('glurk')
     user.save()
     sheet.owner = user
     self.assertEquals(len(OneTimePad.objects.all()), 0)
     self.assertEquals(
         sheet.create_private_key(),
         OneTimePad.objects.get(user=sheet.owner).guid)
     sheet._delete_private_key()
Пример #5
0
    def test_calculate_calls_calculate_with_unjsonified_worksheet_and_saves_recalced_json(
            self, mock_calculate):
        sheet = Sheet()
        sheet.jsonify_worksheet = Mock()
        sheet.unjsonify_worksheet = Mock()
        sheet.usercode = sentinel.usercode
        sheet.timeout_seconds = sentinel.timeout_seconds
        sheet.create_private_key = Mock()
        sheet.otp = Mock()

        sheet.calculate()

        self.assertCalledOnce(mock_calculate,
                              sheet.unjsonify_worksheet.return_value,
                              sheet.usercode, sheet.timeout_seconds,
                              sheet.create_private_key.return_value)
        self.assertCalledOnce(sheet.jsonify_worksheet,
                              sheet.unjsonify_worksheet.return_value)
Пример #6
0
    def test_calculate_calls_calculate_with_unjsonified_worksheet_and_saves_recalced_json(
        self, mock_calculate
    ):
        sheet = Sheet()
        sheet.jsonify_worksheet = Mock()
        sheet.unjsonify_worksheet = Mock()
        sheet.usercode = sentinel.usercode
        sheet.timeout_seconds = sentinel.timeout_seconds
        sheet.create_private_key = Mock()
        sheet.otp = Mock()

        sheet.calculate()

        self.assertCalledOnce(
            mock_calculate,
            sheet.unjsonify_worksheet.return_value,
            sheet.usercode,
            sheet.timeout_seconds,
            sheet.create_private_key.return_value
        )
        self.assertCalledOnce(sheet.jsonify_worksheet, sheet.unjsonify_worksheet.return_value)