Beispiel #1
0
 def test_raises_exception_if_end_time_is_not_int(self):
     whale = WhaleAlert()
     self.assertRaises(ValueError,
                       whale.get_transactions,
                       0,
                       end_time='not_an_int',
                       api_key='1234')
Beispiel #2
0
 def setUp(self):
     self.whale = WhaleAlert(working_directory=TEST_WORKING_DIR)
     self.writer = Writer(self.whale.get_status(),
                          self.whale.get_database())
     self.reader = Reader(self.whale.get_status(),
                          self.whale.get_database(),
                          self.whale.get_configuration())
Beispiel #3
0
 def test_no_config_get_transactions_works_as_normal(self):
     whale = WhaleAlert()
     whale.transactions.get_transactions = mock.MagicMock().method()
     whale.transactions.get_transactions.return_value = (False, {}, {})
     expected = [mock.call(0, None, 'asdf', None, 500000, 100)]
     whale.get_transactions(0, api_key='asdf')
     self.assertEqual(whale.transactions.get_transactions.mock_calls,
                      expected)
Beispiel #4
0
 def test_status_database_config_are_none_with_no_working_directory(self):
     whale = WhaleAlert()
     config = whale.get_configuration()
     status = whale.get_status()
     database = whale.get_database()
     self.assertIs(config, None)
     self.assertIs(status, None)
     self.assertIs(database, None)
Beispiel #5
0
    def test_no_api_key_and_no_working_directory_returns_false_and_doesnt_call(
            self):
        whale = WhaleAlert()
        success = whale.fetch_and_store_data(0, 0)

        whale.transactions.get_transactions = mock.MagicMock().method()
        self.assertEqual(len(whale.transactions.get_transactions.mock_calls),
                         0)
        self.assertIs(success, False)
Beispiel #6
0
 def setUp(self):
     self.whale = WhaleAlert(TEST_WORKING_DIR, log_level=logging.DEBUG)
     self.config = self.whale.get_configuration()
     self.status = self.whale.get_status()
     self.database = self.whale.get_database()
Beispiel #7
0
 def test_return_false_if_no_working_directory(self):
     whale = WhaleAlert()
     success = whale.to_excel()
     self.assertEqual(success, False)
Beispiel #8
0
 def setUp(self):
     self.whale = WhaleAlert(TEST_WORKING_DIR)
     self.config = self.whale.get_configuration()
     self.status = self.whale.get_status()
     self.database = self.whale.get_database()
Beispiel #9
0
 def test_writing_status_with_no_working_directory_returns_false(self):
     whale = WhaleAlert()
     success = whale.write_custom_status(good_status)
     self.assertEqual(success, False)
Beispiel #10
0
 def test_no_config_value_raises_exception_if_api_key_not_supplied(self):
     whale = WhaleAlert()
     self.assertRaises(ValueError, whale.get_transactions, 0)
Beispiel #11
0
 def test_configuration_directories_and_files_created_ok_with_good_directory(
         self):
     whale = WhaleAlert(working_directory=TEST_WORKING_DIR,
                        log_level=logging.DEBUG)
     self.check_directories_are(TEST_WORKING_DIR, True)