Exemplo n.º 1
0
 def test_get_score_sheet_if_not_present_in_db_and_fetch(
         self, mock_client_call):
     expected = test_score_encoding.get_sample()
     mock_client_call.return_value = expected.encode("utf-8")
     document = score_encoding.get_score_sheet("12012")
     self.assertJSONEqual(document, expected,
                          "Should fetch document from queue")
Exemplo n.º 2
0
    def test_get_score_sheet_if_present_in_db_but_outdated(self, mock_client_call):
        global_id = "12012"
        new_score_encoding = test_score_encoding.create_score_encoding(global_id=global_id)
        new_score_encoding.document = test_score_encoding.get_old_sample()
        new_score_encoding.save()

        expected = test_score_encoding.get_sample()
        mock_client_call.return_value = expected.encode("utf-8")
        document = score_encoding.get_score_sheet(global_id)
        self.assertJSONEqual(document, expected, "Should fetch document from queue")
Exemplo n.º 3
0
    def test_get_score_sheet_if_present_in_db_but_outdated(
            self, mock_client_call):
        global_id = "12012"
        new_score_encoding = test_score_encoding.create_score_encoding(
            global_id=global_id)
        new_score_encoding.document = test_score_encoding.get_old_sample()
        new_score_encoding.save()

        expected = test_score_encoding.get_sample()
        mock_client_call.return_value = expected.encode("utf-8")
        document = score_encoding.get_score_sheet(global_id)
        self.assertJSONEqual(document, expected,
                             "Should fetch document from queue")
Exemplo n.º 4
0
 def test_get_score_sheet_if_not_present_in_db_and_fetch(self, mock_client_call):
     expected = test_score_encoding.get_sample()
     mock_client_call.return_value = expected.encode("utf-8")
     document = score_encoding.get_score_sheet("12012")
     self.assertJSONEqual(document, expected, "Should fetch document from queue")