提交 9f355422 编写于 作者: ToTensor's avatar ToTensor

send topic success

上级 7b5785d4
Title (one line describing the story)
Narrative:
As a [role]
I want [feature]
So that [benefit]
Acceptance criteria: (presented as Scenarios)
Scenario 1: Title
Given [context]
And [some more context]...
When [event]
Then [outcome]
And [another outcome]...
Scenario 2: ...
\ No newline at end of file
public static void main(String[] args) {
// 首先创建一个 FireFox 浏览器webdriver的实例,并让浏览器访问必应
WebDriver driver = new FirefoxDriver();
driver.get("http://cn.bing.com");
// 获取页面的 title
System.out.println("Home Page title: " + driver.getTitle());
// 通过id找到input的web UI元素,并在此域内输入“软件测试”,并提交
WebElement element = driver.findElement(By.id("sb_form_q"));
// 或通过xPath来定位web元素
// element = driver.findElement(By.xpath("*[@id='sb_form_q']"))
// 在此域内输入“软件测试”,并提交
element.sendKeys(软件测试);
element.submit();
// 通过判断 title 内容等待搜索页面加载完毕
(new WebDriverWait(driver, 10)).until(new ExpectedCondition() {
public Boolean apply(WebDriver d) {
return d.getTitle().toLowerCase().endsWith(软件测试);
}
});
System.out.println("Result Page title: " + driver.getTitle());
driver.quit();
}
\ No newline at end of file
4.0.0    
MySel20Proj     
MySel20Proj
1.0
org.seleniumhq.selenium        
selenium-java        
2.53.0
        
org.seleniumhq.selenium        
htmlunit-driver        
2.20
java -jar selenium-server-standalone-x.xx.x.jar -role hub 
java -jar selenium-server-standalone-x.xx.x.jar -role node -port 5551 
java -jar selenium-server-standalone-x.xx.x.jar -role node -port 5552 
……
\ No newline at end of file
public class EditorTest extends
ActivityInstrumentationTestCase2 {
private Solo solo;
public EditorTest(){
super(EditorActivity.class);
}
public void setUp() throws Exception {
solo = new Solo(getInstrumentation(),getActivity());
}
public void testPreferenceIsSaved() throws Exception {
solo.sendKey(Solo.MENU);
solo.clickOnText("More");
solo.clickOnText("Preferences");
solo.clickOnText("Edit File Extensions")
solo.clickOnText(solo.searchText("rtf"));
solo.clickOnText("txt");
solo.clearEditText(2);
solo.enterText(2,"robotium");
solo.clickOnButton("Save");
solo.goBack();
solo.clickOnText("Edit File Extensions");
Assert.assertTrue(solo.searchText("application/robotium"));
}
@Override
public void tearDown() throws Exception {
solo.finishOpenedActivities();
}
\ No newline at end of file
Feature: Refund item
Scenario: Jeff returns a faulty microwave
Given Jeff has bought a microwave for $100
And he has a receipt
When he returns the microwave
Then Jeff should be refunded $100
\ No newline at end of file
......@@ -13,7 +13,7 @@ def modify_dir_name():
# print(dir_list_)
dir_list = []
for i in dir_list_:
root_dir = os.path.join(data_dir ,i)
root_dir = os.path.join(data_dir, i)
if os.path.isdir(root_dir):
dir_list.append(root_dir)
......@@ -95,7 +95,7 @@ def post(url, params, retry=3, headers=None):
def send_topic():
data_dir = 'data'
web_url = "https://codechina.csdn.net/csdn/book_code_c798a5992a654857867ec15660e1c32a/-/blob/master/"
web_url = "https://codechina.csdn.net/csdn/content/book_code_c798a5992a654857867ec15660e1c32a/-/blob/master/"
request_url = 'http://ccloud.internal.csdn.net/v1/internal/community/content/sendTopic'
files = get_files_path('data/books/1.Python编程无师自通', '.py')
......@@ -110,7 +110,8 @@ def send_topic():
topic_title = topic_title.replace(' ', '.')
# topic_title = html.escape(topic_title)
topic_content = web_url + file
topic_content = "代码:<a href=\"{}\">{}</a>".format(topic_content, topic_title)
topic_content = "代码:<a href=\"{}\">{}</a>".format(
topic_content, topic_title)
send_topic_request_param = {
"type": "long_text",
......@@ -123,7 +124,6 @@ def send_topic():
"bizNo": "ebook"
}
if chapter_code_mapping.get(file) is None:
# resp = post(request_url, send_topic_request_param)
# topic_link = resp['data']['content']['url']
......@@ -131,13 +131,17 @@ def send_topic():
# print('{}:{}'.format(file, topic_link))
print('错误')
else:
send_topic_request_param['id'] = int(chapter_code_mapping[file].split('/')[-1])
send_topic_request_param['id'] = int(
chapter_code_mapping[file].split('/')[-1])
resp = post(request_url, send_topic_request_param)
print('{}:{}'.format(file, chapter_code_mapping.get(file)))
save_mapping = json.dumps(chapter_code_mapping, ensure_ascii=False, indent=2)
save_mapping = json.dumps(chapter_code_mapping,
ensure_ascii=False,
indent=2)
print(save_mapping)
with open(mapping_path, 'w') as f:
f.write(save_mapping)
send_topic()
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册