-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ticket 131: seed denied domains table #132
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,16 +112,169 @@ def test_denied_domains_data_seed(alembic_runner: MigrationContext, alembic_engi | |
# Migrate up to, but not including this new migration | ||
alembic_runner.migrate_up_before("d6e4a13fbebd") | ||
|
||
denied_domains_inserted = [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you alphabetize this list? It'll make it easier to see like-domains and know where to put new ones, rather than always tacking to the end of the list, which makes it more likely to have merge conflicts. If you're using VSCode, there's a handy Sort Lines Ascending command for just this sort (sorry) of thing: |
||
("aol.com"), | ||
("att.net"), | ||
("comcast.net"), | ||
("facebook.com"), | ||
("gmail.com"), | ||
("gmx.com"), | ||
("googlemail.com"), | ||
("google.com"), | ||
("hotmail.com"), | ||
("hotmail.co.uk"), | ||
("mac.com"), | ||
("me.com"), | ||
("mail.com"), | ||
("msn.com"), | ||
("live.com"), | ||
("sbcglobal.net"), | ||
("verizon.net"), | ||
("yahoo.com"), | ||
("yahoo.co.uk"), | ||
("email.com"), | ||
("fastmail.fm"), | ||
("games.com"), | ||
("gmx.net"), | ||
("hush.com"), | ||
("hushmail.com"), | ||
("icloud.com"), | ||
("iname.com"), | ||
("inbox.com"), | ||
("lavabit.com"), | ||
("love.com"), | ||
("outlook.com"), | ||
("pobox.com"), | ||
("protonmail.ch"), | ||
("protonmail.com"), | ||
("tutanota.de"), | ||
("tutanota.com"), | ||
("tutamail.com"), | ||
("tuta.io"), | ||
("keemail.me"), | ||
("rocketmail.com"), | ||
("safe-mail.net"), | ||
("wow.com,ygm.com"), | ||
("ymail.com"), | ||
("zoho.com"), | ||
("yandex.com"), | ||
("bellsouth.net"), | ||
("charter.net"), | ||
("cox.net"), | ||
("earthlink.net"), | ||
("juno.com"), | ||
("btinternet.com"), | ||
("virginmedia.com"), | ||
("blueyonder.co.uk"), | ||
("freeserve.co.uk"), | ||
("live.co.uk"), | ||
("ntlworld.com"), | ||
("o2.co.uk"), | ||
("orange.net"), | ||
("sky.com"), | ||
("talktalk.co.uk"), | ||
("tiscali.co.uk"), | ||
("virgin.net"), | ||
("wanadoo.co.uk"), | ||
("bt.com"), | ||
("sina.com"), | ||
("sina.cn"), | ||
("qq.com"), | ||
("naver.com"), | ||
("hanmail.net"), | ||
("daum.net"), | ||
("nate.com"), | ||
("yahoo.co.jp"), | ||
("yahoo.co.kr"), | ||
("yahoo.co.id"), | ||
("yahoo.co.in"), | ||
("yahoo.com.sg"), | ||
("yahoo.com.ph"), | ||
("163.com"), | ||
("yeah.net"), | ||
("126.com"), | ||
("21cn.com"), | ||
("aliyun.com"), | ||
("foxmail.com"), | ||
("hotmail.fr"), | ||
("live.fr"), | ||
("laposte.net"), | ||
("yahoo.fr"), | ||
("wanadoo.fr"), | ||
("orange.fr"), | ||
("gmx.fr"), | ||
("sfr.fr"), | ||
("neuf.fr"), | ||
("free.fr"), | ||
("gmx.de"), | ||
("hotmail.de"), | ||
("live.de"), | ||
("online.de"), | ||
("t-online.de"), | ||
("web.de"), | ||
("yahoo.de"), | ||
("libero.it"), | ||
("virgilio.it"), | ||
("hotmail.it"), | ||
("aol.it"), | ||
("tiscali.it"), | ||
("alice.it"), | ||
("live.it"), | ||
("yahoo.it"), | ||
("email.it"), | ||
("tin.it"), | ||
("poste.it"), | ||
("teletu.it"), | ||
("mail.ru"), | ||
("rambler.ru"), | ||
("yandex.ru"), | ||
("ya.ru"), | ||
("list.ru"), | ||
("hotmail.be"), | ||
("live.be"), | ||
("skynet.be"), | ||
("voo.be"), | ||
("tvcablenet.be"), | ||
("telenet.be"), | ||
("hotmail.com.ar"), | ||
("live.com.ar"), | ||
("yahoo.com.ar"), | ||
("fibertel.com.ar"), | ||
("speedy.com.ar"), | ||
("arnet.com.ar"), | ||
("yahoo.com.mx"), | ||
("live.com.mx"), | ||
("hotmail.es"), | ||
("hotmail.com.mx"), | ||
("prodigy.net.mx"), | ||
("yahoo.ca"), | ||
("hotmail.ca"), | ||
("bell.net"), | ||
("shaw.ca"), | ||
("sympatico.ca"), | ||
("rogers.com"), | ||
("yahoo.com.br"), | ||
("hotmail.com.br"), | ||
("outlook.com.br"), | ||
("uol.com.br"), | ||
("bol.com.br"), | ||
("terra.com.br"), | ||
("ig.com.br"), | ||
("itelefonica.com.br"), | ||
("r7.com"), | ||
("zipmail.com.br"), | ||
("globo.com"), | ||
("globomail.com"), | ||
("oi.com.br"), | ||
] | ||
|
||
# Test denied_domains seed | ||
denied_domain_tablename = "denied_domains" | ||
alembic_runner.migrate_up_one() | ||
with alembic_engine.connect() as conn: | ||
denied_domains_rows = conn.execute( | ||
text("SELECT domain from %s where domain = :domain " % denied_domain_tablename), (dict(domain="yahoo.fr")) | ||
).fetchall() | ||
denied_domains_expected = [("yahoo.fr",)] | ||
denied_domains_rows = conn.execute(text("SELECT * FROM %s" % denied_domain_tablename)).fetchall() | ||
|
||
assert denied_domains_rows == denied_domains_expected | ||
assert [elem[0] for elem in denied_domains_rows] == denied_domains_inserted | ||
|
||
alembic_runner.migrate_down_one() | ||
with alembic_engine.connect() as conn: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should check the full list was inserted, either by referencing the list in alembic script or copying the expected seed data and comparing it against a select all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it.