Пример #1
0
    def test_snapshots(self, mocked_upload):
        mocked_upload.return_value = 'http://s3.com/your-file.csv'

        SimpleQueryFactory(snapshot=True)
        SimpleQueryFactory(snapshot=True)
        SimpleQueryFactory(snapshot=True)
        SimpleQueryFactory(snapshot=False)

        snapshot_queries()
        self.assertEqual(mocked_upload.call_count, 3)
Пример #2
0
    def test_snapshots(self, mocked_upload):
        mocked_upload.return_value = 'http://s3.com/your-file.csv'

        SimpleQueryFactory(snapshot=True)
        SimpleQueryFactory(snapshot=True)
        SimpleQueryFactory(snapshot=True)
        SimpleQueryFactory(snapshot=False)

        snapshot_queries()
        self.assertEqual(mocked_upload.call_count, 3)
Пример #3
0
    def test_snapshots(self, mocked_s3):
        conn = Mock()
        conn.upload = Mock()
        conn.upload.return_value = type('obj', (object,), {'url': 'http://s3.com/your-file.csv'})
        mocked_s3.return_value = conn

        SimpleQueryFactory(snapshot=True)
        SimpleQueryFactory(snapshot=True)
        SimpleQueryFactory(snapshot=True)
        SimpleQueryFactory(snapshot=False)

        snapshot_queries()
        self.assertEqual(conn.upload.call_count, 3)
Пример #4
0
    def test_snapshots(self, mocked_s3):
        conn = Mock()
        conn.upload = Mock()
        conn.upload.return_value = type('obj', (object,), {'url': 'http://s3.com/your-file.csv'})
        mocked_s3.return_value = conn

        SimpleQueryFactory(snapshot=True)
        SimpleQueryFactory(snapshot=True)
        SimpleQueryFactory(snapshot=True)
        SimpleQueryFactory(snapshot=False)

        snapshot_queries()
        self.assertEqual(conn.upload.call_count, 3)
    def test_snapshots(self, mocked_s3):
        s3_client = Mock()
        s3_client.generate_presigned_url = Mock()
        s3_client.generate_presigned_url.return_value = 'http://s3.com/your-file.csv'
        mocked_s3.return_value = s3_client

        SimpleQueryFactory(snapshot=True)
        SimpleQueryFactory(snapshot=True)
        SimpleQueryFactory(snapshot=True)
        SimpleQueryFactory(snapshot=False)

        snapshot_queries()
        self.assertEqual(s3_client.generate_presigned_url.call_count, 3)